<script setup lang="ts">
import { getEnterpriseDetailAPI } from '@/apis/enterprise';
import type { EnterpriseDetail } from '@/types/enterprise';
import { ref } from 'vue';
import { useRoute } from 'vue-router';

const route = useRoute()

const WatchEnterprise = ref<EnterpriseDetail>()
const getEnterpriseDetail = async () => {
  const res = await getEnterpriseDetailAPI(route.params.id as string)
  // console.log(res)
  WatchEnterprise.value = res.data
}
if (route.params.id) {
  getEnterpriseDetail()
}

</script>

<template>
  <div class="add-enterprise">
    <header class="add-header">
      <el-page-header content="查看企业" @back="$router.back()" />
    </header>
    <main class="add-main">
      <div class="form-container">
        <div class="title">企业信息</div>
        <div class="form">
          <el-form>
            <el-form-item label="企业名称:" prop="name">
              {{ WatchEnterprise?.name }}
            </el-form-item>
            <el-form-item label="法人:" prop="legalPerson">
              {{ WatchEnterprise?.legalPerson }}
            </el-form-item>
            <el-form-item label="注册地址:" prop="registeredAddress">
              {{ WatchEnterprise?.registeredAddress }}
            </el-form-item>
            <el-form-item label="所在行业:" prop="industryCode">
              {{ WatchEnterprise?.industryName }}
            </el-form-item>
            <el-form-item label="企业联系人:" prop="contact">
             {{ WatchEnterprise?.contact }}
            </el-form-item>
            <el-form-item label="联系电话:" prop="contactNumber">
              {{ WatchEnterprise?.contactNumber }}
            </el-form-item>
            <el-form-item label="营业执照:" prop="businessLicenseUrl">
              <img :src="WatchEnterprise?.businessLicenseUrl" alt="" mode="widthFix">
            </el-form-item>
          </el-form>
        </div>
      </div>
    </main>
    <footer class="add-footer">
    </footer>
  </div>
</template>

<style scoped lang="scss">
img{
  height: 300px;
}
.add-enterprise {
  background-color: #f4f6f8;
  height: 100vh;

  .add-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 64px;
    line-height: 64px;
    font-size: 16px;
    font-weight: bold;
    background-color: #fff;

    .left {
      span {
        margin-right: 4px;
      }

      .arrow {
        cursor: pointer;
      }
    }

    .right {
      text-align: right;
    }
  }

  .add-main {
    background: #f4f6f8;
    padding: 20px 130px;
    .form-container {
      background-color: #fff;

      .title {
        height: 60px;
        line-height: 60px;
        padding-left: 20px;
      }

      .form {
        margin-bottom: 20px;
        padding: 20px 65px 24px;

        .el-form {
          display: flex;
          flex-wrap: wrap;

          .el-form-item {
            width: 50%;
          }
        }
      }
    }
  }

  .add-footer {
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 24px 50px;
    color: #000000d9;
    font-size: 14px;
    background: #fff;
    text-align: center;
  }
}
</style>